/**
 * This program is free software but WITHOUT ANY WARRANTY OR CONDITIONS OF ANY KIND.
 *
 * Copyright (C) 2011-2012 www.pretty-tools.com
 */

chrome.browserAction.onClicked.addListener(function(tab) {
    var href = tab.url;
    var url = 'http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1000&st._surl='+encodeURIComponent(href);
    var wnd = window.open("", "_blank", "top=" + ((screen.height / 2) - (180)) + ",left=" + ((screen.width / 2) - (300)) + ",width=600,height=360,resizable=1");
    var content = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html lang="ru" xml:lang="ru" xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="content-type" content="text/html; charset=UTF-8" /><title>&#1054;&#1076;&#1085;&#1086;&#1082;&#1083;&#1072;&#1089;&#1089;&#1085;&#1080;&#1082;&#1080;.ru</title></head><body style="margin:0;padding:0;"><div style="width:100%;padding:17px 0;text-align:center;background-color:#F93;color:white;font:normal 14px/16px verdana">&#1055;&#1088;&#1086;&#1080;&#1089;&#1093;&#1086;&#1076;&#1080;&#1090; &#1079;&#1072;&#1075;&#1088;&#1091;&#1079;&#1082;&#1072;...</div></body></html>';
    wnd.document.write(content);
    wnd.location.href = url;
});

if ("false" != localStorage["isFirstStart"]) {
    window.open("http://odnoklassniki.pretty-tools.com/installed_for_chrome.htm", "_blank");
    localStorage["isFirstStart"] = "false";
}
